<?php
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
/*
$a= json_decode('{"code":0,"data":{"name":"root","type":"staff","expired_at":1467911307,"lkey":"ddc5c440b8c8c94d167878fde11c96b1_577e706bb14ba","ret_time":1467904107}}',true);
var_dump($a);
exit;*/
require_once 'auth.php';
/*
if ( $_COOKIE['user_info'] )
{
    $arr = json_decode($_COOKIE['user_info'], true);
    if ( $arr['code'] == -1 )
    {
        setcookie('user_info', NULL);
        header('Location: http://web.sso.com/login.html');
    }
    else
    {
        echo $_COOKIE['user_info'];
    }
}
else
{
    header('Location: http://web.sso.com/login.html');
}*/

if ( !empty($user) )
{
    echo "<p>" . "欢迎你!, ".$user["name"] . "</p>";
    echo '<a href="logout.php">注销</a>';
}
else
{
    echo "<p>认证失败</p>";
}
?>
